﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using WordDocumentGenerator.Library;

namespace GPS.ENTITYS
{
    #region Export Word thông tin chi tiết
    public class CrudModelDKH
    {
        public decimal ID { get; set; }
        public string KH_MA { get; set; }
        public string KH_DVGTVT_MA { get; set; }
        public string KH_TEN { get; set; }
        public string KH_HANGGPLX_MA { get; set; }
        public string KH_HANGDT_MA { get; set; }
        [DisplayFormat(DataFormatString = "{0:0}", ApplyFormatInEditMode = true)]
        public decimal KH_HANGDT_RANK { get; set; }
        public string KH_SOQDKG { get; set; }
        [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        public Nullable<System.DateTime> KH_NGAYQDKG { get; set; }
        [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        public Nullable<System.DateTime> KH_NGAYKG { get; set; }
        [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
        public Nullable<System.DateTime> KH_NGAYBG { get; set; }
        public string KH_MUCTIEUDT { get; set; }
        public Nullable<System.DateTime> KH_NGAYTHI { get; set; }
        public Nullable<System.DateTime> KH_NGAYSH { get; set; }
        [DisplayFormat(DataFormatString = "{0:0}", ApplyFormatInEditMode = true)]
        public Nullable<decimal> KH_TONGHV { get; set; }
        [DisplayFormat(DataFormatString = "{0:0}", ApplyFormatInEditMode = true)]
        public Nullable<decimal> KH_SOHVTOTNGHIEP { get; set; }
        [DisplayFormat(DataFormatString = "{0:0}", ApplyFormatInEditMode = true)]
        public Nullable<decimal> KH_SOHVDUOCCAPGPLX { get; set; }
        [DisplayFormat(DataFormatString = "{0:0}", ApplyFormatInEditMode = true)]
        public Nullable<decimal> KH_THOIGIANDT { get; set; }
        [DisplayFormat(DataFormatString = "{0:0}", ApplyFormatInEditMode = true)]
        public Nullable<decimal> KH_SONGAYONKIEMTRA { get; set; }
        [DisplayFormat(DataFormatString = "{0:0}", ApplyFormatInEditMode = true)]
        public Nullable<decimal> KH_SONGAYTHUCHOC { get; set; }
        [DisplayFormat(DataFormatString = "{0:0}", ApplyFormatInEditMode = true)]
        public Nullable<decimal> KH_SONGAYNGHILE { get; set; }
        [DisplayFormat(DataFormatString = "{0:0}", ApplyFormatInEditMode = true)]
        public Nullable<decimal> KH_TONGSONGAY { get; set; }
        public string KH_MOTA { get; set; }
        public string KH_ACTIVE { get; set; }
        [DisplayFormat(DataFormatString = "{0:0}", ApplyFormatInEditMode = true)]
        public Nullable<decimal> KH_TTXL_MA { get; set; }
        public Nullable<System.DateTime> KH_NGAYNHAP { get; set; }
        public string KH_NGUOINHAP { get; set; }
        public Nullable<System.DateTime> KH_NGAYSUA { get; set; }
        public string KH_NGUOISUA { get; set; }
    }


    public class EXPORTWORD_KHOAHOC
    {
        public static byte[] EXPORT_KHOAHOC(string templateFileName, object objSource, string docType)
        {
            DocumentGenerationInfo generationInfo = GetDocumentGenerationInfo(docType, "1.0", objSource, templateFileName, false);
            COMMON.ExportCore<CrudModelDKH> docGenerator = new COMMON.ExportCore<CrudModelDKH>(generationInfo);
            return docGenerator.GenerateDocument();
        }
        /// <summary>
        /// Gets the document generation info.
        /// </summary>
        /// <param name="docType">Type of the doc.</param>
        /// <param name="docVersion">The doc version.</param>
        /// <param name="dataContext">The data context.</param>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="useDataBoundControls">if set to <c>true</c> [use data bound controls].</param>
        /// <returns></returns>
        private static DocumentGenerationInfo GetDocumentGenerationInfo(string docType, string docVersion, object dataContext, string fileName, bool useDataBoundControls)
        {
            DocumentGenerationInfo generationInfo = new DocumentGenerationInfo();
            generationInfo.Metadata = new DocumentMetadata
            {
                DocumentType = docType,
                DocumentVersion = docVersion
            };
            generationInfo.DataContext = dataContext;
            generationInfo.TemplateData = File.ReadAllBytes(fileName);
            generationInfo.IsDataBoundControls = useDataBoundControls;
            return generationInfo;
        }

    }
    #endregion

    #region Export word tiến độ đào tạo

    public class CrudModelDKH_KHDT
    {
        public string DVGTVT_TEN { get; set; }
        public string KH_MA_TEN { get; set; }
        public string KH_HANGGPLX_MA { get; set; }
        public string KH_THOIGIANDT { get; set; }
        public string KH_TONGHV { get; set; }
        public string DTMONHOC_MA { get; set; }
        public string DTMONHOC_TEN { get; set; }
        public string DTMONHOC_TONGGIO { get; set; }
        public string DTMONHOC_GIOLT { get; set; }
        public string DTMONHOC_GIOTH { get; set; }
        public string DTMONHOC_GIOTHHINH { get; set; }
        public string DTMONHOC_GIOTHDUONG { get; set; }
        public string DTMONHOC_KIEMTRA { get; set; }
        public string DTMONHOC_MOTA { get; set; }
        public string KH_LH_THANG { get; set; }
        public string KH_LH_TUAN { get; set; }
        public string KH_LH_TUNGAY { get; set; }
        public string KH_LH_DENNGAY { get; set; }
        public string KH_LH_GDOAN_MA { get; set; }
        public string STT_DS_GV_TH { get; set; }
        public string KH_LH_KIEMTRA { get; set; }
        public string GV_LYTHUYET { get; set; }
        public string KH_LH_PT_BIENSO { get; set; }
        public string GV_HOTEN { get; set; }
        public string KH_LH_SOHOCVIEN { get; set; }
        public string GHICHU { get; set; }
        public string Rowcolumn { get; set; }
        public string PHAN_GIAI_DOAN { get; set; }
        public string W01 { get; set; }
        public string W02 { get; set; }
        public string W03 { get; set; }
        public string W04 { get; set; }
        public string W05 { get; set; }
        public string W06 { get; set; }
        public string W07 { get; set; }
        public string W08 { get; set; }
        public string W09 { get; set; }
        public string W10 { get; set; }
        public string W11 { get; set; }
        public string W12 { get; set; }
        public string W13 { get; set; }
        public string W14 { get; set; }
        public string W15 { get; set; }
        public string W16 { get; set; }
        public string W17 { get; set; }
        public string W18 { get; set; }
        public string W19 { get; set; }
        public string W20 { get; set; }
        public string W21 { get; set; }
        public string W22 { get; set; }
        public string W23 { get; set; }
        public string W24 { get; set; }
        public string W25 { get; set; }
        public string W26 { get; set; }
        public string T1 { get; set; }
        public string T2 { get; set; }
        public string T3 { get; set; }
        public string T4 { get; set; }
        public string T5 { get; set; }
        public string T6 { get; set; }
        public string T7 { get; set; }
        public List<CrudModelDKH_KHDT> LIST_GioHoc { get; set; }
        public List<CrudModelDKH_KHDT> LIST_LichHoc { get; set; }
        public List<CrudModelDKH_KHDT> LIST_GVLThuyet { get; set; }
        public List<CrudModelDKH_KHDT> LIST_GVThucHanh { get; set; }
        public List<CrudModelDKH_KHDT> LIST_THANGHOC { get; set; }
    }


    public class EXPORTWORD_KHOAHOC_KHDT
    {
        public static byte[] EXPORT_KHOAHOC_KHDT(string templateFileName, object objSource, string docType)
        {
            DocumentGenerationInfo generationInfo = GetDocumentGenerationInfo(docType, "1.0", objSource, templateFileName, false);
            COMMON.ExportCore<CrudModelDKH_KHDT> docGenerator = new COMMON.ExportCore<CrudModelDKH_KHDT>(generationInfo);
            return docGenerator.GenerateDocument();
        }
        /// <summary>
        /// Gets the document generation info.
        /// </summary>
        /// <param name="docType">Type of the doc.</param>
        /// <param name="docVersion">The doc version.</param>
        /// <param name="dataContext">The data context.</param>
        /// <param name="fileName">Name of the file.</param>
        /// <param name="useDataBoundControls">if set to <c>true</c> [use data bound controls].</param>
        /// <returns></returns>
        private static DocumentGenerationInfo GetDocumentGenerationInfo(string docType, string docVersion, object dataContext, string fileName, bool useDataBoundControls)
        {
            DocumentGenerationInfo generationInfo = new DocumentGenerationInfo();
            generationInfo.Metadata = new DocumentMetadata
            {
                DocumentType = docType,
                DocumentVersion = docVersion
            };
            generationInfo.DataContext = dataContext;
            generationInfo.TemplateData = File.ReadAllBytes(fileName);
            generationInfo.IsDataBoundControls = useDataBoundControls;
            return generationInfo;
        }

    }

    #endregion

    #region Export excel lưu lượng đào tạo

    public class ExportExcel_LuuLuong
    {
        public string KH_TEN { get; set; }
        public string KH_NGAYKG { get; set; }
        public string KH_NGAYBG { get; set; }
        public decimal? KH_TONGHV { get; set; }
        public string DVGTVT_LLDT { get; set; }
        public string TUAN_HOC { get; set; }
        public string THANG_HOC { get; set; }
        public string THANG_KG { get; set; }
        public string TUAN_KG { get; set; }
        public string NAM_KG { get; set; }
        public string THANG_BG { get; set; }
        public string TUAN_BG { get; set; }
        public string NAM_BG { get; set; }
        public string HANG_DT { get; set; }
    }
    #endregion

    public class ComlumnThang_LuuLuong
    {
        public int ICOL { get; set; }
        public string THANG { get; set; }
    }
    #region Export excel tiến độ đào tạo

    public class ExportExcel_TienDo
    {
        public string KH_TEN { get; set; }
        public string GV_HOTEN { get; set; }
        public decimal? KH_TONGHV { get; set; }
        public string KH_LH_GDOAN_MA { get; set; }
        public string THANG_HOC { get; set; }
        public string NGAY_HOC { get; set; }
        public string TUAN_HOC { get; set; }
        public string THANG { get; set; }
        public string KH_LH_PT_BIENSO { get; set; }
        public DateTime? KH_LH_TUNGAY { get; set; }
        public DateTime? KH_LH_DENNGAY { get; set; }
    }
    #endregion

}
